import request from './request'

export function getDiscussionList(params) {
  return request({
    url: '/api/problem-discussions/page',
    method: 'get',
    params
  })
}

export function addDiscussion(data) {
  return request({
    url: '/api/problem-discussions/add',
    method: 'post',
    data
  })
}

export function addReply(data) {
  return request({
    url: '/api/problem-discussions/reply',
    method: 'post',
    data
  })
}

// 获取讨论回复列表
export const getDiscussionReplies = (discussionId, userId) => {
  return request({
    url: `/api/problem-discussions/${discussionId}/replies`,
    method: 'get',
    params: { userId }
  })
}